package User;

public class User implements Comparable<User>
{
	private int id;
	private UserPreference pref = new UserPreference();
	
	public User(int id)
	{
		this.id = id;
	}
	
	public void addRating(int itemid, double rating)
	{
		pref.addRating(itemid, rating);
	}
	
	public int getId()
	{
		return id;
	}
	
	public double getRating(int itemid)
	{
		return pref.getRating(itemid);
	}
	
	public Rating[] getRatings()
	{
		return pref.getRatings();
	}
	
	public double[] getRatings(int[] ids)
	{
		return pref.getRatings(ids);
	}
	
	public int[] getItemids()
	{
		return pref.getItemids();
	}
	
	public int[] getSharedIds(User user)
	{
		return pref.getSharedIds(user);
	}
	
	public int[] getNotShared(int[] items)
	{
		return pref.getNotShared(items);
	}
	
	public boolean equals(User u)
	{
		return getId() == u.getId();
	}
	
	public String toString()
	{
		String str = "User id: " + id + "\n";
		str += pref.toString();
		
		return str;
	}

	@Override
	public int compareTo(User u)
	{
		return Integer.compare(getId(), u.getId());
	}
}
